﻿using ChuangDu_Spirit_QGB_BLLContainer;
using ChuangDu_Spirit_QGB_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ChuangDu_Spirit_QGB_IBLL;
using ChuangDu_Spirit_QGB_IBLL.ZhengIbll;
using Webdiyer.WebControls.Mvc;

namespace ChuangDu_Spirit_QGB.Areas.Sprintzbh.Controllers
{
    /// <summary>
    /// 客户服务管理
    /// </summary>
    public class CsmController : Controller
    {
        // GET: Sprintzbh/Csm

        private ICsmBLL userbll = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CsmBLL,ICsmBLL>();
        public int CsmDetails()
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            CsmInfo m = new CsmInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbll.Delete(m);
            }

            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int CsmEdit(CsmInfo t)
        {
            int i = userbll.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmAdd(CsmInfo t)
        {
            int i = userbll.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CsmShow(int id=1)
        {

            IEnumerable<CsmInfo> list = userbll.show().ToPagedList(id,10);
            return View(list);
        }


        /// <summary>
        /// 客户服务管理---类型
        /// </summary>


        private ICsmTypeBLL userbll2 = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CsmTypeBLL,ICsmTypeBLL>();
        public int CsmTypeDetails(CsmTypeInfo t)
        {
            int i = userbll2.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmTypeEdit(CsmTypeInfo t)
        {
            int i = userbll2.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmTypeAdd(CsmTypeInfo t)
        {
            int i = userbll2.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CsmTypeShow()
        {

            IEnumerable<CsmTypeInfo> list = userbll2.show();
            return View(list);
        }
        /// <summary>
        /// 客户服务管理---方式
        /// </summary>


        private ICsmWayBLL userbll3 = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CsmWayBLL,ICsmWayBLL>();
        public int CsmWayDetails(CsmWayInfo t)
        {
            int i = userbll3.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmWayEdit(CsmWayInfo t)
        {
            int i = userbll3.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmWayAdd(CsmWayInfo t)
        {
            int i = userbll3.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CsmWayShow()
        {

            IEnumerable<CsmWayInfo> list = userbll3.show();
            return View(list);
        }
        /// <summary>
        /// 客户服务管理---时间
        /// </summary>


        private ICsmTimeBLL userbll4 =BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CsmTimeBLL,ICsmTimeBLL>();
        public int CsmTimeDetails(CsmTimeInfo t)
        {
            int i = userbll4.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmTimeEdit(CsmTimeInfo t)
        {
            int i = userbll4.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmTimeAdd(CsmTimeInfo t)
        {
            int i = userbll4.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CsmTimeShow()
        {

            IEnumerable<CsmTimeInfo> list = userbll4.show();
            return View(list);
        }
        /// <summary>
        /// 客户服务管理---花费时间
        /// </summary>


        private ICsmSpanTimeBLL userbll5 = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CsmSpanTimeBLL,ICsmSpanTimeBLL>();
        public int CsmSpanTimeDetails(CsmSpanTimeInfo t)
        {
            int i = userbll5.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmSpanTimeEdit(CsmSpanTimeInfo t)
        {
            int i = userbll5.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmSpanTimeAdd(CsmSpanTimeInfo t)
        {
            int i = userbll5.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CsmSpanTimeShow()
        {

            IEnumerable<CsmSpanTimeInfo> list = userbll5.show();
            return View(list);
        }

        /// <summary>
        /// 售后服务---状态
        /// </summary>


        private ICsmStateBLL userbll6 = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CsmStateBLL,ICsmStateBLL>();
        public int CsmStateDetails(CsmStateInfo t)
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            CsmStateInfo  m = new CsmStateInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbll6.Delete(m);
            }
            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int CsmStateEdit(CsmStateInfo t)
        {
            int i = userbll6.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CsmStateAdd( CsmStateInfo t )
        {
            int i = userbll6.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CsmStateShow()
        {

            IEnumerable<CsmStateInfo> list = userbll6.show();
            return View(list);
        }



        /// <summary>
        /// 客户投诉管理
        /// </summary>
        // GET: Sprintzbh/Ccm
        private ICcmBLL userbll7 = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CcmBLL,ICcmBLL>();
        public int CcmDetails()
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            CcmInfo m = new CcmInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbll7.Delete(m);
            }
            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int CcmEdit(CcmInfo t)
        {
            int i = userbll7.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CcmAdd(CcmInfo t)
        {

            int i = userbll7.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CcmShow(int id=1)
        {

            IEnumerable<CcmInfo> list = userbll7.show().ToList().ToPagedList(id,10);
            return View(list);
        }


        /// <summary>
        /// 客户投诉管理---类型
        /// </summary>
        private ICcmTypeBLL userbll8 = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CcmTypeBLL,ICcmTypeBLL>();
        public int CcmTypeDetails()
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            CcmTypeInfo m = new CcmTypeInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbll8.Delete(m);
            }
            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int CcmTypeEdit(CcmTypeInfo t)
        {
            int i = userbll8.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CcmTypeAdd(CcmTypeInfo t)
        {
            int i = userbll8.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CcmTypeShow()
        {

            IEnumerable<CcmTypeInfo> list = userbll8.show();
            return View(list);
        }

        /// <summary>
        /// 客户投诉管理---时间
        /// </summary>
        private ICcmtimeBLL userbll9 = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CcmtimeBLL,ICcmtimeBLL>();
        public int CcmtimeDetails(CcmtimeInfo t)
        {
            int i = userbll9.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CcmtimeEdit()
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            CcmtimeInfo m = new CcmtimeInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbll9.Delete(m);
            }
            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int CcmtimeAdd(CcmtimeInfo t)
        {

            int i = userbll9.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CcmtimeShow()
        {

            IEnumerable<CcmtimeInfo> list = userbll9.show();
            return View(list);
        }




        /// <summary>
        /// 客户关怀
        /// </summary>
        // GET: Sprintzbh/Cshiow
        private ICshiowBLL userbllA = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.CshiowBLL,ICshiowBLL>();
        public int CshiowDetails()
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            CshiowInfo m = new CshiowInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbllA.Delete(m);
            }

            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int CshiowEdit(CshiowInfo t)
        {
            int i = userbllA.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CshiowAdd(CshiowInfo t)
        {
            int i = userbllA.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult CshiowShow(int id=1)
        {

            IEnumerable<CshiowInfo> list = userbllA.show().ToList().ToPagedList(id,10);
            return View(list);
        }





        // GET: Sprintzbh/Aswo
        /// <summary>
        /// 售后工单
        /// </summary>
        private IAswoBLL userbllB = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.AswoBLL,IAswoBLL>();
        public int AswoDetails()
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            AswoInfo m = new AswoInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbllB.Delete(m);
            }
            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int AswoEdit(AswoInfo t)
        {
            int i = userbllB.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AswoAdd(AswoInfo t)
        {
            int i = userbllB.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult AswoShow(int id=1)
        {

            IEnumerable<AswoInfo> list = userbllB.show().ToPagedList(id,10);
            return View(list);
        }



        /// <summary>
        /// 售后工单---时间
        /// </summary>


        private IAswoTimeBLL userbllC = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.AswoTimeBLL,IAswoTimeBLL>();
        public int AswoTimeDetails(AswoTimeInfo t)
        {
            int i = userbllC.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AswoTimeEdit(AswoTimeInfo t)
        {
            int i = userbllC.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AswoTimeAdd(AswoTimeInfo t)
        {
            int i = userbllC.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult AswoTimeShow()
        {

            IEnumerable<AswoTimeInfo> list = userbllC.show();
            return View(list);
        }



        /// <summary>
        /// 售后工单---类型
        /// </summary>


        private IAswoTypeBLL userbllD= BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.AswoTypeBLL,IAswoTypeBLL>();
        public int AswoTypeDetails(AswoTypeInfo t)
        {
            int i = userbllD.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AswoTypeEdit(AswoTypeInfo t)
        {
            int i = userbllD.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AswoTypeAdd(AswoTypeInfo t)
        {
            int i = userbllD.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult AswoTypeShow()
        {

            IEnumerable<AswoTypeInfo> list = userbllD.show();
            return View(list);
        }


        // GET: Sprintzbh/Asi
        /// <summary>
        /// 售后安装
        /// </summary>
        private IAsiBLL userbllE = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.AsiBLL,IAsiBLL>();
        public int AsiDetails(AsiInfo t)
        {
            var ids = Request["ids"];
            int rows = 0;
            string[] i = ids.Split(',');
            AsiInfo m = new AsiInfo();
            foreach (string x in i)
            {
                m.Id = Convert.ToInt32(x);
                rows = rows + userbllE.Delete(m);
            }
            if (rows > 0)
                return 1;
            else
                return 0;
        }
        public int AsiEdit(AsiInfo t)
        {
            int i = userbllE.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AsiAdd(AsiInfo t)
        {
            int i = userbllE.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult AsiShow(int id=1)
        {

            IEnumerable<AsiInfo> list = userbllE.show().ToList().ToPagedList(id,10);
            return View(list);
        }

        /// <summary>
        /// 售后安装类别
        /// </summary>
        private IAsiTypeBLL userbllF = BLLContainer.Resolve<ChuangDu_Spirit_QGB_BLL.ZhengBll.AsiTypeBLL,IAsiTypeBLL>();
        public int AsiTypeDetails(AsiTypeInfo t)
        {
            int i = userbllF.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AsiTypeEdit(AsiTypeInfo t)
        {
            int i = userbllF.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int AsiTypeAdd(AsiTypeInfo t)
        {

            int i = userbllF.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public ActionResult AsiTypeShow()
        {

            IEnumerable<AsiTypeInfo> list = userbllF.show();
            return View(list);
        }
    }
}